const app = getApp();
Page({
    data: {
      tabIdx: 0,
      menuIdx: 0,
      tabInfo: [
        { title: '一级', num: 0 },
        { title: '二级', num: 0 }
      ],
      menuInfo: [
        { title: '全部' },
        { title: '已入账' },
        { title: '待入账' },
        { title: '失效' },
      ],
      type_name: ['店铺入驻', ' 开通同城卡', ' 信息发布', ' 店铺升级', ' 商品核销', ' 送礼物'],
    },
    onLoad: function(t) {
      var that =this
      var a = that.data.tabInfo
      app.ihttpGet('https://www.58zltc.com/api.php/Commission/getLv/openid/' + app.globalData.openid, function (res) {
        wx.hideLoading()
        var num_1 = res.data.lv_one.length
        var num_2 = res.data.lv_two.length
        num_1 ? num_1 : 0
        num_2 ? num_2 : 0
        a[0].num = num_1
        a[1].num = num_2
        that.setData({
          info: res.data,
          tabInfo: a,
          allNum: num_1 + num_2
        })
      })
    },
    backto: function (e) {
      wx.navigateBack({})
    },
    changeTab: function (e) {
      this.setData({
        tabIdx: e.currentTarget.dataset.num
      })
    },
    changeMenu: function (e) {
      this.setData({
        menuIdx: e.currentTarget.dataset.num
      })
    }
});